package com.ww.learn.oop.property

class Rectangle(val width: Int, val height: Int) {
    /**
     * C#也有类似功能
     */
//    val area: Int
//        get() = this.width * this.height

    // 省略写法
    val area get() = this.width * this.height
}

fun main() {
    val rectangle = Rectangle(10, 20)
    println(rectangle.area)
}